AmCharts.addInitHandler(function(chart){function loadFile(a,b,c,d){if(void 0===d&&(d="dataProvider"),c.showCurtain&&showCurtain(void 0,c.noStyles),l.remaining++,window.XMLHttpRequest)var e=new XMLHttpRequest;else var e=new ActiveXObject("Microsoft.XMLHTTP");e.onreadystatechange=function(){if(4==e.readyState&&404==e.status)raiseError(__("Error loading the file")+": "+a,!1,c);else if(4==e.readyState&&200==e.status){switch(void 0===c.format&&(c.format="json"),c.format=c.format.toLowerCase(),c.format){case"json":b[d]=postprocess(parseJSON(e.responseText,c),c);break;case"csv":b[d]=postprocess(parseCSV(e.responseText,c),c);break;default:raiseError(__("Unsupported data format")+": "+c.format,f,c.noStyles)}if(l.remaining--,0===l.remaining){if(c.async)if("map"===chart.type)chart.validateNow(!0);else if(chart.validateData(),l.startDuration)if("stock"===chart.type){chart.panelsSettings.startDuration=l.startDuration;for(var g in chart.panels)chart.panels[g].startDuration=l.startDuration,chart.panels[g].animateAgain()}else chart.startDuration=l.startDuration,chart.animateAgain();"stock"!==chart.type||c.reloading||chart.periodSelector.setDefaultPeriod(),removeCurtain()}c.reload&&(c.timeout&&clearTimeout(c.timeout),c.timeout=setTimeout(loadFile,1e3*c.reload,a,b,c),c.reloading=!0)}};try{e.open("GET",c.timestamp?timestampUrl(a):a,c.async),e.send()}catch(f){raiseError(__("Error loading the file")+": "+a,f,c)}}function parseJSON(response,options){try{return void 0!==JSON?JSON.parse(response):eval(response)}catch(e){return raiseError(__("Error parsing JSON file")+": "+l.url,e,options),[]}}function parseCSV(a,b){var c=CSVToArray(a,b.delimiter),d=[],e=[];b.useColumnNames&&(e=c.shift(),0<b.skip&&b.skip--);for(var f=0;f<b.skip;f++)c.shift();for(var g;g=b.reverse?c.pop():c.shift();){for(var h={},f=0;f<g.length;f++){var i=void 0===e[f]?"col"+f:e[f];h[i]=g[f]}d.push(h)}return d}function postprocess(a,b){if(void 0===b.postProcess||!isFunction(b.postProcess))return a;try{return b.postProcess.call(this,a,b)}catch(c){return raiseError(__("Error loading file")+": "+b.url,!1,b),a}}function isArray(a){return a instanceof Array}function isObject(a){return"object"==typeof a}function isFunction(a){return"function"==typeof a}function applyDefaults(a){for(var b in defaults)setDefault(a,b,defaults[b])}function setDefault(a,b,c){void 0===a[b]&&(a[b]=c)}function raiseError(a,b,c){c.showErrors?showCurtain(a,c.noStyles):(removeCurtain(),console.log(a))}function __(a){return void 0!==chart.language&&void 0!==AmCharts.translations.dataLoader[chart.language]&&void 0!==AmCharts.translations.dataLoader[chart.language][a]?AmCharts.translations.dataLoader[chart.language][a]:a}function showCurtain(a,b){removeCurtain(),void 0===a&&(a=__("Loading data..."));var c=document.createElement("div");c.setAttribute("id",chart.div.id+"-curtain"),c.className="amcharts-dataloader-curtain",!0!==b?(c.style.position="absolute",c.style.top=0,c.style.left=0,c.style.width=(void 0!==chart.realWidth?chart.realWidth:chart.divRealWidth)+"px",c.style.height=(void 0!==chart.realHeight?chart.realHeight:chart.divRealHeight)+"px",c.style.textAlign="center",c.style.display="table",c.style.fontSize="20px",c.style.background="rgba(255, 255, 255, 0.3)",c.innerHTML='<div style="display: table-cell; vertical-align: middle;">'+a+"</div>"):c.innerHTML=a,chart.containerDiv.appendChild(c),l.curtain=c}function removeCurtain(){try{void 0!==l.curtain&&chart.containerDiv.removeChild(l.curtain)}catch(a){}l.curtain=void 0}function timestampUrl(a){var b=a.split("?");return 1===b.length?b[1]=(new Date).getTime():b[1]+="&"+(new Date).getTime(),b.join("?")}function CSVToArray(a,b){b=b||",";for(var c=new RegExp("(\\"+b+"|\\r?\\n|\\r|^)"+'(?:"([^"]*(?:""[^"]*)*)"|'+'([^"\\'+b+"\\r\\n]*))","gi"),d=[[]],e=null;e=c.exec(a);){var f=e[1];if(f.length&&f!=b&&d.push([]),e[2])var g=e[2].replace(new RegExp('""',"g"),'"');else var g=e[3];d[d.length-1].push(g)}return d}void 0!==chart.dataLoader&&isObject(chart.dataLoader)||(chart.dataLoader={});var version=chart.version.split(".");if(!(Number(version[0])<3||3==Number(version[0])&&Number(version[1])<13)){var l=chart.dataLoader;l.remaining=0;var defaults={async:!0,format:"json",showErrors:!0,showCurtain:!0,noStyles:!1,reload:0,timestamp:!1,delimiter:",",skip:0,useColumnNames:!1,reverse:!1,reloading:!1};if("stock"===chart.type)setTimeout(function(){0>chart.panelsSettings.startDuration&&(l.startDuration=chart.panelsSettings.startDuration,chart.panelsSettings.startDuration=0);for(var a in chart.dataSets){var b=chart.dataSets[a];void 0!==b.dataLoader&&void 0!==b.dataLoader.url&&(b.dataProvider=[],applyDefaults(b.dataLoader),loadFile(b.dataLoader.url,b,b.dataLoader,"dataProvider")),void 0!==b.eventDataLoader&&void 0!==b.eventDataLoader.url&&(b.events=[],applyDefaults(b.eventDataLoader),loadFile(b.eventDataLoader.url,b,b.eventDataLoader,"stockEvents"))}},100);else{if(applyDefaults(l),void 0===l.url)return;void 0!==chart.startDuration&&0<chart.startDuration&&(l.startDuration=chart.startDuration,chart.startDuration=0),chart.dataProvider=[],loadFile(l.url,chart,l,"dataProvider")}}},["pie","serial","xy","funnel","radar","gauge","stock","map"]);